import VueRouter from "vue-router";
import Vue from "vue";
Vue.use(VueRouter)

import Home from "@/views/Home.vue";
import Topic from "@/views/Topic.vue";
import Category from "@/views/Category.vue";
import Cart from "@/views/Cart.vue";
import User from "@/views/User.vue";
import Search from "@/views/Search.vue"

const routes = [
    { path: "/", redirect: '/home' },  // 重定向:重新指向其它path,会改变网址},
    {
        path: "/home", component: Home, name: "home", meta: { isShow: true },
        //  二级路由
        children: [
            { path: "search", component: Search, name: "search", meta: { isShow: false } }
        ]
    },
    { path: "/topic", component: Topic, name: "Topic", meta: { isShow: true }, },
    { path: "/category", component: Category, name: "Category", meta: { isShow: true }, },
    { path: "/cart", component: Cart, name: "Cart", meta: { isShow: true }, },
    { path: "/user", component: User, name: "User", meta: { isShow: true }, },


]

var router = new VueRouter({
    routes,
    mode: "history"
})

export default router
